package GateWars;

public class ArmoryParser {

	public static void parse(String s){
		String[] elements = s.split("<TR>");
		for(int i = 0; i < elements.length; i++){
			//System.out.print(i + ":\n" + elements[i]);
		}
		/*String[] temp;
		temp = elements[9].split("page=");
		temp = temp[1].split(" \"");
		GateWarsFactory.getGateWarsManager().page = new Integer(temp[0].trim().replace(",", ""));
		
		temp = elements[12].split("Turns: ");
		temp = temp[1].split("</b>");
		GateWarsFactory.getGateWarsManager().turns = new Short(temp[0].trim().replace(",", ""));
		
		temp = elements[13].split("Naquadah: ");
		temp = temp[1].split("</b>");
		GateWarsFactory.getGateWarsManager().naq = new Long(temp[0].trim().replace(",", ""));
		
		temp = elements[14].split(": ");
		temp = temp[3].split("</A>");
		GateWarsFactory.getGateWarsManager().bankNaq = new Long(temp[0].trim().replace(",", ""));
		
		temp = elements[15].split("Next Turn:");
		temp = temp[1].split(" min");
		GateWarsFactory.getGateWarsManager().nextTurn = new Byte(temp[0].trim());*/
		
		int mark = 27;
		while(elements[mark].trim().startsWith("<TD>")){
			String temp1 = elements[mark].substring(elements[mark].indexOf("<TD align=right>") + 28, elements[mark].indexOf("        </TD>"));
			String temp2 = elements[mark].substring(elements[mark].indexOf("<TD align=middle>") + 29, elements[mark].indexOf("          /"));
			String temp3 = elements[mark].substring(elements[mark].indexOf("          /") + 22, elements[mark].indexOf("          /") + 23 + temp2.length());
			System.out.println(temp1 + ", " + temp2 + ", " + temp3);
			mark += 3;
		}
		mark++;
		while(elements[mark].trim().startsWith("<TD>")){
			String temp1 = elements[mark].substring(elements[mark].indexOf("<TD align=right>") + 28, elements[mark].indexOf("        </TD>"));
			String temp2 = elements[mark].substring(elements[mark].indexOf("<TD align=middle>") + 29, elements[mark].indexOf("          /"));
			String temp3 = elements[mark].substring(elements[mark].indexOf("          /") + 22, elements[mark].indexOf("          /") + 23 + temp2.length());
			System.out.println(temp1 + ", " + temp2 + ", " + temp3);
			mark += 3;
		}
	}
}
